package com.marry.requestLogger.controller;

import com.alibaba.fastjson.JSONObject;
import com.marry.requestLogger.util.LoggerUtils;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.RestController;

import javax.servlet.http.HttpServletRequest;

/**
 * @author ml
 * @create 2017-07-03--16:03
 */
@RestController
@RequestMapping(value = "/index")
public class IndexController {


    @RequestMapping(value = "/login",method = RequestMethod.GET)
    public JSONObject login(HttpServletRequest request,String name) throws Exception{
        JSONObject obj=new JSONObject();
        obj.put("msg","用户："+name+",登录成功！");

        request.setAttribute(LoggerUtils.LOGGER_TETURN,obj);
        return obj;
    }
}
